<%@ include file="../../common/taglibs.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="<c:url value='/ext/resources/css/ext-all.css'/>" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/fontpatch.css'/>" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/application.css'/>" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/Ext.ux.grid.RowActions.css'/>" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/icons.css'/>" />
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/form_float.css'/>" />

<title><fmt:message key="format.message.system" /></title>
</head>

<body>

<div id="loading-mask" style=""></div>
<div id="loading">
	<div class="loading-indicator">
		<img src="<c:url value='/images/extanim32.gif'/>" width="32" height="32" style="margin-right: 8px;" /><fmt:message key="format.message.loading" />
	</div>
</div>

<script type="text/javascript" src="<c:url value='/scripts/jsloader.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/resourceFile.js'/>"></script>
<script type="text/javascript" >
Ext.namespace('azure', 'azure.common');

var tabContent, leftPanel, viewport;
azure.common.main = function() {

	function createTab() {
		tabContent = new Ext.TabPanel({
			border : false,
			region : 'center',
			activeTab : 0,
			items : [{
				title : '<fmt:message key="format.menu.mainPanel" />',
				autoLoad : {
					url : '/newbingo/pages/main/desktop.html',
					scripts : true
				}
			}]
		});
	}

	function createleftPanel() {
		leftPanel = new Ext.Panel({
			region : 'west',
			collapsible : false,
			width : 200,
			layout : 'accordion',
			layoutConfig : {
				animate : true
			},
			items : [ {
				border : false,
				title : '<fmt:message key="format.menu.ManagementGameSetting" />',
				items : [{
					border : false,
				    html:'&nbsp;&nbsp;<font size='+-1+'><a href="javascript:openPage(\'addGame\',\'<fmt:message key="format.menu.AddGame" />\',\'/newbingo/pages/gameMgr/gameList.jsp\')"><fmt:message key="format.menu.AddGame" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'gameEnrty\',\'<fmt:message key="format.menu.GameEnrty" />\',\'/newbingo/pages/gameMgr/gameEnrty.jsp\')"><fmt:message key="format.menu.GameEnrty" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'historyLotteryQuery\',\'<fmt:message key="format.menu.HistoryLotteryQuery" />\',\'/newbingo/pages/gameMgr/historyLotteryQuery.jsp\')"><fmt:message key="format.menu.HistoryLotteryQuery" /></a></font>'
				}]
			},{
				border : false,
				title : '<fmt:message key="format.menu.ManagementAgent" />',
				items : [{
					border : false,
				    html:'&nbsp;&nbsp;<font size='+-1+'><a href="javascript:openPage(\'managementAgent\',\'<fmt:message key="format.menu.ManagementAgent" />\',\'/newbingo/pages/agentMgr/agentList.jsp\')"><fmt:message key="format.menu.ManagementAgent" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'managementAgentSubordinate\',\'<fmt:message key="format.menu.ManagementAgentSubordinate" />\',\'/newbingo/pages/agentMgr/agentListed.jsp\')"><fmt:message key="format.menu.ManagementAgentSubordinate" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'managementMember\',\'<fmt:message key="format.menu.ManagementMember" />\',\'/newbingo/pages/agentMgr/memberList.jsp\')"><fmt:message key="format.menu.ManagementMember" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'betSetting\',\'<fmt:message key="format.menu.GameSetting" />\',\'/newbingo/pages/agentMgr/betSetting.jsp\')"><fmt:message key="format.menu.GameSetting" /></a></font>'
				},{
					border : false,
					html : '&nbsp;&nbsp;<font size=' + -1 + '><a href="javascript:openPage(\'agentHistoryLottery\',\'<fmt:message key="format.menu.AgentHistoryLottery" />\',\'/newbingo/pages/agentMgr/agentHistoryLottery.jsp\')"><fmt:message key="format.menu.AgentHistoryLottery" /></a></font>'
				}]
			},{
				title : '<fmt:message key="format.menu.ManagementWEBSITE" />',
				border : false,
				items : [{
					border : false,
					html : '&nbsp;&nbsp;<font size='
							+ -1
							+ '><a href="javascript:openPage(\'info\',\'<fmt:message key="format.menu.Atention" />\',\'/newbingo/pages/siteInfo/atention.jsp\')"><fmt:message key="format.menu.Atention" /></a></font>'
				}]
			}]

		});
	}

	function createView() {
		createTab();
		createleftPanel();
		
		var header = new Ext.Panel( {
		border :true,
		region :'north',
		layout :'anchor',
		height :65,
		border :false,
		items : [ {
			xtype :'box',
			border :true,
			el :'header'
		}]
		});

		//定期更新时间
		var clock = new Ext.Toolbar.TextItem(new Date().format('Y-m-d G:i:s A'));
		Ext.TaskMgr.start({
		  run: function(){
		        Ext.fly(clock.getEl()).update(new Date().format('Y-m-d G:i:s A'));
		  },
		  interval: 1000
		});
		Ext.TaskMgr.start({
			  run: function(){
			 Ext.Ajax
             .request( {
                     url : 'Affiche_findDynaByPage.action',
                     scope : this,
                     success : function(resp, opts) {
                             var temp = eval('(' + resp.responseText + ')');
                             var news=''; 
                             
                             if(temp.affes.data.length > 0){
                             for(var i =0;i<temp.affes.data.length;i++){
                            	news=news + '<br/><br/><br/>'+temp.affes.data[i].affId+'、'+temp.affes.data[i].contents;
                             }
                             Ext.getDom('atentionNews').innerHTML=news + '<br/><br/>';
                             }
                     },
                     params : {
                    	 dynaType : 0
                 }
             });
			  },
			  interval: 60000
		});

		viewport = new Ext.Viewport({
			layout : 'border',
			items : [header,{
				region : 'west',
				title : '<fmt:message key="format.menu.main" />',
				width : 200,
				minSize : 175,
				maxSize : 300,
				layout : 'fit',
				collapsible :true,
				collapseMode :'mini',
				tbar:['<b><fmt:message key="format.menu.Time" /></b>：',clock],
				items : [leftPanel]
			}, {
				id : 'mainPanel',
				region : 'center',
				border : false,
				layout : 'fit',
				items : [tabContent],
				autoScroll : true
			}]
		});

		viewport.doLayout();

		Ext.get('loading').remove();
		Ext.get('loading-mask').fadeOut({
			remove :true
		});
	}

	return {
		init : function() {
			createView();
		}
	};

}();

function openPage(id, text, url) {
	openPage(id, text, url,'');
}

function newPanel(id, text, url,idval){
	var	newTab = new Ext.Panel({
			id : id,
			idvalue:idval,
			title : text,
			border : false,
			layout:'fit',
			autoLoad : {
				url : url,
				scripts : true
			},
			html : "" + url + "",
			closable : true
		});
		return newTab;
}

function openPage(id, text, url,idval) {
	var t1 = tabContent.findById(id);
	if (t1 == null) {
		t1 = newPanel(id, text, url,idval);
	}else{
		tabContent.remove(t1);
		t1 = newPanel(id, text, url,idval);
	}
	tabContent.add(t1);
	t1.show();
}
Ext.onReady(azure.common.main.init, azure.common.main, true);

</script>


<div id="header">
	<div class="mx-logoSection">
		<div align='center'>
		<b><fmt:message key="format.menu.AtentionTitle" /></b>
		</div>
		
		<marquee hspace="0" height="32" width="43%" scrollamount="3" scrolldelay="400" direction="up" onmouseover="this.stop()" onmouseout="this.start()">
		<div id="atentionNews"></div>
		</marquee>
		<a href="#"><img src="images/header/btn_hd_support.gif"	alt="button" onclick="javascript:modifyPassWord()"/></a> 
		<a href="#"><img src="images/header/btn_hd_help.gif" alt="button" /></a> 
		<a href="#"><img src="images/header/btn_hd_exit.gif"	onclick="javascript:location.href='logout.jsp'" alt="exit"/></a><br>
		${user.uname},<fmt:message key="format.message.hello" /> 
	</div>	
</div>

<div id="footer" class="x-hidden x-date-bottom footer x-toolbar" style="vertical-align: middle;"><span class="ytb-text">Version 1.0</span></div>

</body>
